$(function () {
    $.post(Feng.ctxPath + "/outpatientManagement/getList", function (data) {  //初始化下拉到店门诊列表
        var txt = '<option value="">请选择</option>';
        for (var i = 0; i < data.length; i++) {
            txt += '<option value="' + data[i].simplename + '">' + data[i].simplename + '</option>';
        }
        document.getElementById('outpatientName').innerHTML = txt;
    }, "json");

    $('#submit_login').click(function () {
        var userName = $('#userName').val();
        var passWord = $('#passWord').val();
        var outpatientName = $('#outpatientName').val();
        if(outpatientName == "请选择门店"){
            alert("请选择门店!")
        }else {
            $.ajax({
                url: Feng.ctxPath + "/weixin/login",
                type: "post",
                data: {
                    "username": userName,
                    "outpatientName": outpatientName,
                    "password": passWord
                },
                success: function (data) {
                    window.location.href = Feng.ctxPath + "/weixin/index";
                },
                error: function (data) {
                    alert('权限被限制，请联系管理员!');
                    window.location.href = Feng.ctxPath + "/weixin/login";
                }
            });
        }
    });

    var viewHeight = window.innerHeight;
    $("input").focus(function(){
        var signInTop = $(".signIn").offset().top;
        var btnTop = $(".btnBox").offset().top;
        $(".Resetbody,html").css({"height":viewHeight});
        $(".signIn").css('top',signInTop);
        $(".btnBox").css('top',btnTop);
    });
})